<?
// *************************************
// * user.php allows the admin to
// * View and Delete admin users.
// *************************************
$sajax = 1;
define('SITE_AREA', 'users');

$jsFile = "jsUsers.js";
include("includes/functions.php");
include($pre."includes/sajax/sajaxUsers.php");

sajax_init();
$sajax_request_type = "POST"; 
sajax_export("deleteUser");
sajax_export("editUser");
sajax_export("saveUser");
sajax_handle_client_request();

include("includes/header.php"); ?>
	<div id="addEditFormDiv" style="display: none;"></div>	
	
	<div id="content0">
		<div id="buttonNew" style="float: left; width: 180px;"><input type="button" class="buttonBig buttonAddBig" value="New User" onClick="addUser();" title="Add new user" id="buttonAddUser" /></div>
		<div id="statusDiv" style="float: left;"></div>
		<div style="clear: left; height: 10px;"></div>
		
		<div id="content0FormDiv">
		<div id="formNewUser" class="blueBox" style="display: none;">		
			<input type="hidden" id="formAction" />
			<input type="hidden" id="uID" />
			
			<p><label class="vertLabel">Name</label>
			<input type="text" style="width: 195px; margin-right: 5px;" value="First Name" id="uUserNameFirst" name="uUserNameFirst" onFocus="this.value='';" />
			<input type="text" style="width: 195px;" value="Last Name" id="uUserNameLast" name="uUserNameLast" onFocus="this.value='';"  />
			</p>
			
			<p><label class="vertLabel">Email Address</label>
			<input type="text" style="width: 400px;" id="uEmail" name="uEmail" /></p>
						
			<p><label class="vertLabel">User Name</label>
			<input type="text" style="width: 400px;" id="uUserNameBox" name="uUserNameBox" /></p>
			
			<p><label class="vertLabel">Password</label>
			<input type="text" style="width: 400px;" id="uPassword" name="uPassword" /></p>
				
			<p><label class="vertLabel">Confirm Password</label>
			<input type="text" style="width: 400px;" id="uPasswordConfirm" name="uPasswordConfirm" /></p>
			
			<p><label class="vertLabel">Program</label>
			<select id="uUserProgram" size="1" style="width: 400px;">
			<option>Select...</option>
			<? echo getPrograms('select'); ?>
			</select>
			</p>
						
			<p><label class="vertLabel">User Level</label>
				<select size="1" id="uUserLevel">
				<option>Select...</option>
				<option></option>
				<?
				// Render user levels
				for($a=1;$a<=count($userLevelArray);$a++) {
					echo '<option value="'.$a.'">'.$userLevelArray[$a].'</option>';
				}
				?>
				</select>				
			</p>
									
			<p style="margin-top: 15px; margin-left: 6px;">
				<input type="button" class="buttonBig buttonSaveBig" onClick="saveUser();" value="Save" title="Save user" />
				<input type="button" class="buttonBig buttonCancelBig" onClick="cancelUser();" value="Cancel" title="Cancel" />
			</p>
			
			<select size="1" id="uUserLevelForGrid" style="display: none;">				
				<option>Select...</option>
				<option></option>
				<?
				// Render user levels
				for($a=1;$a<=count($userLevelArray);$a++) {
					echo '<option value="'.$userLevelArray[$a].'">'.$userLevelArray[$a].'</option>';
				}
				?>
			</select>
		</div>
		</div>
		<div><h3>Current Users</h3></div>
		<div id="userGrid" class="x_grid-mso" style="border: 1px solid #c3daf9; overflow: hidden; height: 460px; width: 750px;"></div>
	</div>
		
	<div id="south" class="x-layout-inactive-content">
	south - generally for informational stuff, also could be for status bar
	</div>
<? include("includes/footer.php"); ?>